package com.beaut.project.util;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
/**
 * 消息通知工具类
 *  ljs
 *  
 */
public class SMSUtil {
	/*模块分类*/
public static Map<Integer,String> smsModuleMap = new HashMap<Integer,String>();
public static int SMS_FLOW = 1;
public static int SMS_GD_SECURITY = 2;
public static int SMS_GD_FINISH_ALARM = 3;
public static int SMS_XM_INVOICE_ALARM = 4;
public static int SMS_GD_DESCRIPTION = 5;
public static int SMS_XM_WARRANTY = 6;
public static int SMS_XM_INVOICE_END_ALARM = 7;
public static int SMS_GD_PURCHASE_APPLY = 8;
public static int SMS_GD_PURCHASE = 9;
public static int SMS_GD_PURCHASE_PRODUCT_IN = 10;
public static int SMS_GD_LOAN = 11;
public static int SMS_GD_ADVANCE = 12;
public static int SMS_GD_YET_ADVANCE = 13;
public static int SMS_XM_FINANCE_EARN = 14;
public static int SMS_XM_FINANCE_PAYMENT = 15;
public static int SMS_XM_FINANCE_REIM = 16;
static{
	smsModuleMap.put(SMS_FLOW, "工作流审批通知");
	smsModuleMap.put(SMS_GD_SECURITY, "工单安质提醒通知");
	smsModuleMap.put(SMS_GD_FINISH_ALARM, "工单完工预警通知");
	smsModuleMap.put(SMS_XM_INVOICE_ALARM, "项目进度开票收款预警通知");
	smsModuleMap.put(SMS_GD_DESCRIPTION, "工单交底完成提醒通知");
	smsModuleMap.put(SMS_XM_WARRANTY, "项目质保金预警通知");
	smsModuleMap.put(SMS_XM_INVOICE_END_ALARM, "项目结算开票收款预警通知");
	smsModuleMap.put(SMS_GD_PURCHASE_APPLY, "工单待处理采购申请提醒通知");
	smsModuleMap.put(SMS_GD_PURCHASE, "待处理订货单提醒通知");
	smsModuleMap.put(SMS_GD_PURCHASE_PRODUCT_IN, "待处理入库单提醒通知");
	smsModuleMap.put(SMS_GD_LOAN, "员工借款支付提醒通知");
	smsModuleMap.put(SMS_GD_ADVANCE, "班组垫款支付提醒通知");
	smsModuleMap.put(SMS_GD_YET_ADVANCE, "班组垫款还款提醒通知");
	smsModuleMap.put(SMS_XM_FINANCE_EARN, "项目收款待办提醒通知");
	smsModuleMap.put(SMS_XM_FINANCE_PAYMENT, "项目支付待办提醒通知");
	smsModuleMap.put(SMS_XM_FINANCE_REIM, "项目报账待办提醒通知");
}

public static String getSMSModuleNameByKey(int key){
	return smsModuleMap.get(key);
}

public static String AZ_ADMIN = "安质员";
public static String WAREHOUSE_ADMIN = "仓库管理员";
public static String FINANCE_ADMIN = "会计";
/**
 * 关闭数据库资源

 * @param dbConn
 * @param stmt
 * @param rs
 */
public static void close(
    Statement stmt, ResultSet rs, Logger log) {
  try {
    if (rs != null) {
      rs.close();
    }
  }catch(Exception ex) {
    if (log != null && log.isDebugEnabled()) {
      log.debug(ex.getMessage(), ex);
    }
  }
  try {
    if (stmt != null) {
      stmt.close();
    }
  }catch(Exception ex) {
    if (log != null && log.isDebugEnabled()) {
      log.debug(ex.getMessage(), ex);
    }
  }
}

/**
 * 关闭数据库资源

 * @param dbConn
 * @param rs
 */
public static void closeDbConn(
    Connection dbConn, Logger log) {
  try {
    if (dbConn != null) {
      dbConn.close();
      dbConn=null;
    }
  }catch(Exception ex) {
    if (log != null && log.isDebugEnabled()) {
      log.debug(ex.getMessage(), ex);
    }
  }    
}

}
